package com.kalua.list.domainmodel.springintegration;

import java.beans.PropertyEditorSupport;

import com.kalua.list.domainmodel.NumericId;
import com.obixlabs.commons.types.PrimitiveTypeUtilities;

public class NumericIdTypeEditor extends PropertyEditorSupport {
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		if (PrimitiveTypeUtilities.isValidInteger(text))			
			setValue(new NumericId(new Long(text)));
		else throw new IllegalArgumentException("Specified value is not a number.");
	}
}